// @ts-ignore
/* eslint-disable */
import { request } from '@/utils/requestWrapper';
import type { API } from '@/backend/typings.d';
import {tokenStore} from "@/store/tokenStore";
const tokenStoreInstance = tokenStore();

/** 新增评论 POST /api/productReview/add */
export async function addProductReviewUsingPost(
  body: API.ProductReviewAddRequest,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseLong_>({
    url: "/api/productReview/add",
    method: "POST",
    header: {
      "Content-Type": "application/json",
      'Authorization': tokenStoreInstance.getToken,
    },
    data: body,
    ...options
  });
}

/** 删除评论 POST /api/productReview/delete */
export async function deleteProductReviewUsingPost(
  body: API.DeleteRequest,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseBoolean_>({
    url: "/api/productReview/delete",
    method: "POST",
    data: body,
    header: {
      "Content-Type": "application/json",
      'Authorization': tokenStoreInstance.getToken,
    },
    ...options
  });
}

/** 根据商品id获取评论 POST /api/productReview/get/vo */
export async function getProductReviewVoByIdUsingPost(
  body: API.ProductReviewQueryByIdRequest,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseListProductReviewVO_>({
    url: "/api/productReview/get/vo",
    method: "POST",
    header: {
      "Content-Type": "application/json",
      'Authorization': tokenStoreInstance.getToken,
    },
    data: body,
    ...options
  });
}

/** 获取自己的评论 POST /api/productReview/my/list/page/vo */
export async function listMyProductReviewVoByPageUsingPost(
  body: API.ProductReviewQueryRequest,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponsePageProductReviewVO_>({
    url: "/api/productReview/my/list/page/vo",
    method: "POST",
    header: {
      "Content-Type": "application/json",
      'Authorization': tokenStoreInstance.getToken,
    },
    data: body,
    ...options
  });
}
